import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * The incoming emergency will be connected to the telephone that is on the desk
 * 
 * @author Jonathan van Es
 */
public class Desk extends Actor
{   
    private Telephone Telephone;
    private calamiteit calamiteit;

    public void setCalamiteit(calamiteit cal){
        calamiteit  = cal;
        if(Telephone != null && !Telephone.getinuse()){
            Telephone.ring();
        }
    }

    public calamiteit getCalamiteit()
    {
        return calamiteit;

    }
    public Desk()
    {
        // add every desk, a telephone will me made
        Telephone = new Telephone();

    }
    public void start()
    {
        getWorld().addObject(Telephone, this.getX(), this.getY());
    }

    public void act() 
    {

    }    

    public Telephone getTelephone()
    {
        return Telephone;
    }

    public void reset(){
        this.calamiteit = null;
        this.Telephone.setRotation(0);
    }

}
